LOCAL_PATH := $(call my-dir)

APP_OPTIM := debug

ifeq ($(APP_OPTIM),debug)
	LIBDIR := obj/local
else
	LIBDIR := libs
endif

# Link to libXt
include $(CLEAR_VARS)
LOCAL_MODULE := libXt
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)

# Link to libXmu
include $(CLEAR_VARS)
LOCAL_MODULE := libXmu
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)

# Link to libXpm
include $(CLEAR_VARS)
LOCAL_MODULE := libXpm
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)

# Link to libXaw
include $(CLEAR_VARS)
LOCAL_MODULE := libXaw
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)

# Link to libX11
include $(CLEAR_VARS)
LOCAL_MODULE := libX11
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)

# Dependencies by libs above:
include $(CLEAR_VARS)
LOCAL_MODULE := libSM
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libICE
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libXau
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libXext
LOCAL_SRC_FILES := ../../$(LOCAL_MODULE)/$(LIBDIR)/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../$(LOCAL_MODULE)/include
include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)

LOCAL_MODULE    := xclock
LOCAL_SRC_FILES := xclock.c Clock.c amain.c
LOCAL_LDLIBS    := -landroid -llog
LOCAL_STATIC_LIBRARIES := android_native_app_glue
LOCAL_SHARED_LIBRARIES := libXt libX11 libXmu libXpm libXaw libSM libICE libXau libXext
LOCAL_CFLAGS :=  -I../libX11/include/X11R6/include/ \
	-I../libX11/include \
	-I../libSM/include \
	-I../libICE/include \
	-DHAVE_CONFIG_H \
	-D_STRINGS_H_ \
	-DOLDXAW 

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)
